//
//  UIButton+Extension.swift
//  DM_新浪微博
//
//  Created by Damon.JiAo on 16/3/8.
//  Copyright © 2016年 Demon_JiAo. All rights reserved.
//

import UIKit

extension UIButton{
    convenience init(title:String?,image:String?,selectedImage:String?,tag:Int,target:AnyObject?,anction:Selector){
        
        self.init()
        
        self.setTitle(title, forState: UIControlState.Normal)
        if let Oimage = image{
            self.setImage(UIImage(named: Oimage), forState: UIControlState.Normal)
        }
        if let OslectedImage = selectedImage{
            self.setImage(UIImage(named: OslectedImage), forState: UIControlState.Selected)
        }
        
        self.tag = tag
        
        self.addTarget(target, action: anction, forControlEvents: UIControlEvents.TouchUpInside)
        
    }
}
